")
/* hello world */
document.write(hello)
var firstName;
document.write('firstName')
var student1 = "Saad bhai"
document.write("student1 ==>"+ student1 + " " +"Mudassir")
var num1 = "10"
var num2 = "abc"
document.write(num1 * num2)
var eq = 2 + 0 + (2 - 5) * 2
document.write(eq)
-4
8
4
20
Result here...
2. Alerts and Prompts
alert("hello world")
document.write("hello world")
alert("hello \n world")
var username;
var myName = "SAAD ALI"
var message;
message = "hello world"
alert(message)
var name = "Saad"
var roll = 123
var uni = "SMIU"
alert(name)
alert(roll)
alert(uni)
Result here...
3. Table From Prompts
var noOfChilds = prompt("Enter number of childs")
var partnerName = prompt("Enter partner name")
var loc = prompt('Enter any location')
var jobTitle = prompt('Enter job title')
document.write(`
No Of Childs
Partner Name
Location
Job Title
${noOfChilds}
${partnerName}
${loc}
${jobTitle}
`)
Result here...
4. Math & Expressions
var num1 = prompt("Enter number")
var num2 = 3
document.write(num1 * num2)
alert(num1 / num2)
var num2 = 5
var num3 = num2+1
var num4 = num3+7
document.write(`
${num2}
`)
document.write(`
${num3}
`)
document.write(`
${num4}
`)
Result here...
5. Ticket & Snack Life
var ticket = 600
document.write(`the cost of 5 ticket is ${ticket * 5}`)
var snack = "Lays"
var age = 10
var maxAge = 85
var dailyDose = 2
var p = dailyDose * 365
var d = maxAge - age
document.write(`
total snacks is ${(dailyDose * 365) * (maxAge - age) }
`)
document.write(`
${p}
`)
document.write(`
${d}
`)
Result here...
6. JS Variable Rules
document.getElementById('h').innerHTML = ("a. A heading stating \u201cRules for naming JS variables")
document.write(`
b. Variable names can only contain Letters, Numbers, Underscores and Dollarsign.
For example $my_1stVariable d. Variable names are case Sensitive e. Variable names should not be JS Keywords